package com.ac.cv.client.menu;

import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.user.client.ui.DeckPanel;

/**
 * A label which own an id used to identify itself
 * @author CHATELLIER
 *
 */
public class MenuItemLabel extends ClickableLabel{

	private int id;

	private DeckPanel panel;
	
	public MenuItemLabel(int id, DeckPanel panel){
		super();
		this.id = id;
		this.panel = panel;
	}
	
	@Override
	public void onClick(ClickEvent event){
		super.onClick(event);
		panel.showWidget(id);
	}
	
	@Override
	public void onSelect() {
		this.getTreeParent().getTree().setSelectedItem(this.getTreeParent());
		this.getTreeParent().getParentItem().setState(true);
		panel.showWidget(id);
	}	
	
	public int getId() {
		return id;
	}
	
	public DeckPanel getPanel() {
		return panel;
	}

	@Override
	public boolean isMainKeyWord() {
		return true;
	}
	
}
